package com.atguigu.gmall.product.controller;

import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.model.product.entity.SkuInfo;
import com.atguigu.gmall.product.service.SkuInfoService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author:lyd
 **/
@RestController
@RequestMapping("/admin/product")
public class SkuAttrController {

    @Autowired
    SkuInfoService skuInfoService;

    /**
     * 分页查询SkuInfo
     * @param current
     * @param size
     * @return
     */
    @GetMapping("/list/{current}/{size}")
    public Result list(@PathVariable("current") Long current,
                      @PathVariable("size") Long size) {
        Page<SkuInfo> page = skuInfoService.page(new Page<>(current, size));
        return Result.ok(page);
    }
}
